//对象初始化
let obj = {};
obj[1] = "abc";
console.log("对象的值为", obj);
console.log("obj[1]的值为", obj[1]);

let str1 = "zhansan";

let obj1 = {
  abc: 25,
  //属性值可以是函数
  say: function () {
    consloe.log("hello");
  },
  //也可以是事先声明的变量
  name: str1,
};

console.log("对象的值为", obj1);

let obj2 = {
  //使用立即执行函数
  age: (() => {
    return 19;
  })(),
};
console.log("对象的值为", obj2);

let key = "age";
let obj3 = {
  [key]: 19,
};
console.log("对象的值为", obj3);

let obj4 = {
  age: 19,
  name: "abc",
};
console.log("最初对象的值为", obj4);

delete obj4.age;
//删除不存在的键不报错
delete obj4.ppt;
console.log("删除后的对象值为", obj4);

//引用类型的值
let myArr = [];
let myObj = {};
myObj["myArr"] = myArr;

console.log("当前对象的值为", myObj);
console.log("当前数组的值为", myArr);

myArr.push(99);
console.log("arr变化后,对象的值为", myObj);
console.log("arr变化后,数组的值为", myArr);
